<?php

namespace App\Models;

use App\Models\Traits\ScopeLikeTrait;
use App\Models\Traits\ScopeTrashedTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Skill extends Model
{
    use SoftDeletes;

    use ScopeLikeTrait;
    use ScopeTrashedTrait;

    public $timestamps = false;

    protected $fillable = ['title', 'description'];

    public function users()
    {
        return $this->belongsToMany(User::class, 'user_skill');
    }

    public function careers()
    {
        return $this->belongsToMany(Career::class)->using(CareerSkill::class)->withPivot(CareerSkill::OTHER_COLUMNS);
    }

    public function courses()
    {
        return $this->belongsToMany(Course::class, 'skill_course')->using(SkillCourse::class)->withPivot(SkillCourse::OTHER_COLUMNS);
    }
}
